package com.xintong.visualinspection.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xintong.visualinspection.bean.Role;
import com.xintong.visualinspection.dao.master.RoleDao;
import com.xintong.visualinspection.service.BaseService;
import com.xintong.visualinspection.service.RoleService;

/**
 * 文件名：UserServiceImpl
 * 版本信息：日期：2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
 */
@Service
public class RoleServiceImpl extends BaseService implements RoleService {

    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(RoleService.class);


    @Autowired
    private RoleDao roleDao;


	@Override
	public List<Role> getRoles(Role role) {
		return roleDao.getRole(role);
	}


	@Override
	public void insert(Role role) {
		roleDao.insert(role);
	}


	@Override
	public void update(Role role) {
		roleDao.update(role);
	}


	@Override
	public void delete(Integer id) {
		roleDao.delete(id);
	}



	@Override
	public List<Role> getRoleByDept(Integer departmentId) {
		return roleDao.getRoleByDept(departmentId);
	}


	@Override
	public List<Role> getRoleByUser(Integer userId) {
		return roleDao.getRoleByUser(userId);
	}


	@Override
	public List<Role> getRoleByPosition(Integer positionId) {
		return getRoleByPosition(positionId);
	}


	@Override
	public void roleBindPermission(Integer roleId, Integer permissionId) {
		Map<String, Integer> part = new HashMap<String,Integer>();
		part.put("roleId", roleId);
		part.put("permissionId", permissionId);
		roleDao.roleBindPermission(part);
	}


	@Override
	public void roleBindUser(Integer roleId, Integer userId) {
		Map<String, Integer> part = new HashMap<String,Integer>();
		part.put("roleId", roleId);
		part.put("userId", userId);
		roleDao.roleBindUser(part);
	}


	@Override
	public void roleBindDepartment(Integer roleId, Integer departmentId) {
		Map<String, Integer> part = new HashMap<String,Integer>();
		part.put("roleId", roleId);
		part.put("departmentId", departmentId);
		roleDao.roleBindDepartment(part);
	}


	@Override
	public void roleBindJob(Integer roleId, Integer jobId) {
		Map<String, Integer> part = new HashMap<String,Integer>();
		part.put("roleId", roleId);
		part.put("jobId", jobId);
		roleDao.roleBindJob(part);
	}

    
}
